package org.tp8.sampleapp.dms.model;

import java.io.Serializable;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlInlineBinaryData;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.tp8.sampleapp.jaxb.adapter.XmlObjectIdAdapter;

/**
 * The Class Course.
 */
@XmlRootElement(name = "bookAttachment")
@XmlAccessorType(XmlAccessType.FIELD)
public class Attachment implements Serializable {

	/**
	 * The Constant serialVersionUID.
	 */
	private static final long serialVersionUID = 3865013646954591904L;

	/**
	 * The id.
	 */
	@Id
	@XmlElement(name = "id")
	@XmlID
	@XmlJavaTypeAdapter(XmlObjectIdAdapter.class)
	private ObjectId id;

	/**
	 * The filename.
	 */
	@XmlElement(name = "filename")
	private String filename;

	/**
	 * The data.
	 */
	@XmlElement(name = "data")
	@XmlInlineBinaryData
	private byte[] data;

	/**
	 * The mime type.
	 */
	@XmlElement(name = "mimeType")
	private String mimeType;

	/**
	 * Gets the id.
	 * 
	 * @return the id
	 */
	public ObjectId getId() {
		return id;
	}

	/**
	 * Sets the id.
	 * 
	 * @param id
	 *            the new id
	 */
	public void setId(ObjectId id) {
		this.id = id;
	}

	/**
	 * Gets the filename.
	 * 
	 * @return the filename
	 */
	public String getFilename() {
		return filename;
	}

	/**
	 * Sets the filename.
	 * 
	 * @param filename
	 *            the new filename
	 */
	public void setFilename(String filename) {
		this.filename = filename;
	}

	/**
	 * Gets the data.
	 * 
	 * @return the data
	 */
	public byte[] getData() {
		return data;
	}

	/**
	 * Sets the data.
	 * 
	 * @param data
	 *            the new data
	 */
	public void setData(byte[] data) {
		this.data = data;
	}

	/**
	 * Gets the mime type.
	 * 
	 * @return the mime type
	 */
	public String getMimeType() {
		return mimeType;
	}

	/**
	 * Sets the mime type.
	 * 
	 * @param mimeType
	 *            the new mime type
	 */
	public void setMimeType(String mimeType) {
		this.mimeType = mimeType;
	}

}
